package hamaster.jpbc.gui;

import static javax.swing.BoxLayout.Y_AXIS;
import static javax.swing.SwingConstants.TOP;
import hamaster.jpbc.Main;

import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.BoxLayout;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;

public class ConfigPanel extends JPanel implements ActionListener {
	private static final long serialVersionUID = 1990019849559164452L;

	Main application;
	CommonConfigPanel commonConfigPanel;
	AESConfigPanel aesConfigPanel;
	Component container;

	public ConfigPanel(Main application, Component container) {
		this.application = application;
		this.container = container;
		setLayout(new BoxLayout(this, Y_AXIS));
		JTabbedPane tabPane = new JTabbedPane();
		tabPane.setTabPlacement(TOP);

		commonConfigPanel = new CommonConfigPanel(this);
		aesConfigPanel = new AESConfigPanel(this);

		tabPane.add(Messages.getString("ConfigPanel.0"), commonConfigPanel); //$NON-NLS-1$
		tabPane.add(Messages.getString("ConfigPanel.1"), aesConfigPanel); //$NON-NLS-1$
		tabPane.setSelectedIndex(0);

		add(tabPane);
	}

	@Override
	public void actionPerformed(ActionEvent e) {
	}

	@Override
	public void setVisible(boolean aFlag) {
		super.setVisible(aFlag);
		container.setVisible(aFlag);
	}

	public static void main(String[] args) {
		ConfigPanel cp = new ConfigPanel(null, null);
		JFrame f = new JFrame();
		f.add(cp);
		f.pack();
		f.setDefaultCloseOperation(3);
		f.setVisible(true);
	}
}
